<?php

namespace App\Http\Controllers\common;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class BaseController extends Controller
{

    /**
     * @param $code
     * @param string $message
     * @param array $data
     * @return false|string
     * 公共的json封装
     */
    public function retJson($code,$message = '',$data = array())
    {
        if(!is_numeric($code))
        {
            return '';
        }

        $result=array(
            'code' => $code,
            'message' => $message,
            'data' => $data
        );

        return json_encode($result);
    }
}
